home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / src / linux-headers-2.6.28-15 / include / linux / i7300_idle.h < prev    next >
Encoding:
C/C++ Source or Header  |  2008-12-24  |  1.8 KB  |  84 lines

  1.  
  2. #ifndef I7300_IDLE_H
  3. #define I7300_IDLE_H
  4.  
  5. #include <linux/pci.h>
  6.  
  7. /*
  8.  * I/O AT controls (PCI bus 0 device 8 function 0)
  9.  * DIMM controls (PCI bus 0 device 16 function 1)
  10.  */
  11. #define IOAT_BUS 0
  12. #define IOAT_DEVFN PCI_DEVFN(8, 0)
  13. #define MEMCTL_BUS 0
  14. #define MEMCTL_DEVFN PCI_DEVFN(16, 1)
  15.  
  16. struct fbd_ioat {
  17.     unsigned int vendor;
  18.     unsigned int ioat_dev;
  19. };
  20.  
  21. /*
  22.  * The i5000 chip-set has the same hooks as the i7300
  23.  * but support is disabled by default because this driver
  24.  * has not been validated on that platform.
  25.  */
  26. #define SUPPORT_I5000 0
  27.  
  28. static const struct fbd_ioat fbd_ioat_list[] = {
  29.     {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT_CNB},
  30. #if SUPPORT_I5000
  31.     {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT},
  32. #endif
  33.     {0, 0}
  34. };
  35.  
  36. /* table of devices that work with this driver */
  37. static const struct pci_device_id pci_tbl[] = {
  38.     { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_FBD_CNB) },
  39. #if SUPPORT_I5000
  40.     { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_5000_ERR) },
  41. #endif
  42.     { } /* Terminating entry */
  43. };
  44.  
  45. /* Check for known platforms with I/O-AT */
  46. static inline int i7300_idle_platform_probe(struct pci_dev **fbd_dev,
  47.                         struct pci_dev **ioat_dev)
  48. {
  49.     int i;
  50.     struct pci_dev *memdev, *dmadev;
  51.  
  52.     memdev = pci_get_bus_and_slot(MEMCTL_BUS, MEMCTL_DEVFN);
  53.     if (!memdev)
  54.         return -ENODEV;
  55.  
  56.     for (i = 0; pci_tbl[i].vendor != 0; i++) {
  57.         if (memdev->vendor == pci_tbl[i].vendor &&
  58.             memdev->device == pci_tbl[i].device) {
  59.             break;
  60.         }
  61.     }
  62.     if (pci_tbl[i].vendor == 0)
  63.         return -ENODEV;
  64.  
  65.     dmadev = pci_get_bus_and_slot(IOAT_BUS, IOAT_DEVFN);
  66.     if (!dmadev)
  67.         return -ENODEV;
  68.  
  69.     for (i = 0; fbd_ioat_list[i].vendor != 0; i++) {
  70.         if (dmadev->vendor == fbd_ioat_list[i].vendor &&
  71.             dmadev->device == fbd_ioat_list[i].ioat_dev) {
  72.             if (fbd_dev)
  73.                 *fbd_dev = memdev;
  74.             if (ioat_dev)
  75.                 *ioat_dev = dmadev;
  76.  
  77.             return 0;
  78.         }
  79.     }
  80.     return -ENODEV;
  81. }
  82.  
  83. #endif
  84.